package com.gxwz.document.business.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gxwz.document.business.dao.IloginRecordDao;
import com.gxwz.document.business.dao.IuserDao;
import com.gxwz.document.business.entity.LoginRecord;
import com.gxwz.document.business.entity.User;
import com.gxwz.document.business.service.IloginRecordService;
import com.gxwz.document.business.service.IuserService;

@SuppressWarnings("unused")
@Service("loginRecordService")
public class LoginRecordServiceImpl implements IloginRecordService {
	
	@Resource(name = "loginRecordDao")
	private IloginRecordDao loginRecordDao;

	@Override
	public List<LoginRecord> findAll() {
		String hql ="from LoginRecord";
		return loginRecordDao.find(hql);
	}	

	@Override
	public LoginRecord findById(int id) {
		return loginRecordDao.findById(LoginRecord.class, id);
	}
	@Override
	public int getRowNum() {	
		return loginRecordDao.findAll().size();
	}

	@Override
	public List<LoginRecord> findByPage(int index, int pageSize) {
		String hql = "from LoginRecord where 1=1";
		return loginRecordDao.findByPage(hql, index, pageSize);
	}

	@Override
	public void delete(int id) {
		loginRecordDao.delete(loginRecordDao.findById(LoginRecord.class, id));	
		
	}
	
	public void save(LoginRecord loginRecord){
		loginRecordDao.saveOrUpdate(loginRecord);
		
	}

}
